package com.market.domain.transients;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Transient;

import com.market.domain.Location;
import com.market.domain.Order;
import com.market.domain.User;

public class OrderQuery implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1448016494929544426L;
	
	
	private Location location;
	private User customer;
	private Order.STATUS status = Order.STATUS.UNKNOWN;
	private Date orderedDate;
	private Date requiredDate;
	
	public void clear(){
		location= null;
		customer = null;
		status = Order.STATUS.UNKNOWN;
		orderedDate = null;
		requiredDate=null;		
	}
	
	public Location getLocation() {
		return location;
	}
	
	public void setLocation(Location location) {
		this.location = location;
	}
	public User getCustomer() {
		return customer;
	}
	public void setCostomer(User customer) {
		this.customer = customer;
	}
	public Order.STATUS getStatus() {
		return status;
	}
	public void setStatus(Order.STATUS status) {
		this.status = status;
	}
	public Date getOrderedDate() {
		return orderedDate;
	}
	public void setOrderedDate(Date orderedDate) {
		this.orderedDate = orderedDate;
	}
	public Date getRequiredDate() {
		return requiredDate;
	}
	public void setRequiredDate(Date requiredDate) {
		this.requiredDate = requiredDate;
	}
	

	@Transient
	public String getRequiredDateLabel(){
		SimpleDateFormat formate = new SimpleDateFormat("yyyy-MM-dd");
		return formate.format(this.requiredDate);
	}
	

}
